package com.huawei.appgallery.forum.forum.card;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import com.huawei.appgallery.forum.base.card.ForumCard;
import com.huawei.appgallery.forum.base.card.ForumCardBean;
import com.huawei.appgallery.forum.base.card.bean.BannerItem;
import com.huawei.appgallery.forum.forum.bean.ForumBannerCardBean;
import com.huawei.appgallery.forum.forum.widget.ForumBanner;
import com.huawei.appgallery.foundation.ui.framework.cardframe.bean.BaseCardBean;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import java.util.ArrayList;
import java.util.List;
import o.bun.c;
import o.cgz;
import o.evx;

public class ForumBannerCard extends ForumCard {
    List<ForumBanner> ˏ = new ArrayList();

    public ForumBannerCard(Context context) {
        super(context);
    }

    public cgz ˏ(View view) {
        ʽ(view);
        ˊ(view);
        return this;
    }

    private void ˊ(View view) {
        this.ˏ.clear();
        LinearLayout linearLayout = (LinearLayout) view.findViewById(c.ॱॱ);
        int childCount = linearLayout.getChildCount();
        for (int i = 0; i < childCount; i++) {
            View childAt = linearLayout.getChildAt(i);
            if (childAt instanceof ForumBanner) {
                ForumBanner forumBanner = (ForumBanner) childAt;
                forumBanner.ˋ((ViewGroup) childAt);
                this.ˏ.add(forumBanner);
            }
        }
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        if (cardBean instanceof ForumBannerCardBean) {
            List ˊ = ((ForumBannerCardBean) cardBean).ˊ();
            int size = this.ˏ.size() <= ˊ.size() ? this.ˏ.size() : ˊ.size();
            for (int i = 0; i < size; i++) {
                BannerItem bannerItem = (BannerItem) ˊ.get(i);
                final ForumBanner forumBanner = (ForumBanner) this.ˏ.get(i);
                forumBanner.setData(bannerItem);
                ForumCardBean forumCardBean = new ForumCardBean();
                forumBanner.setTag(forumCardBean);
                forumCardBean.ॱ(bannerItem.ˏ());
                forumBanner.setOnClickListener(new evx(this) {
                    final /* synthetic */ ForumBannerCard ˋ;

                    public void ˋ(View view) {
                        this.ˋ.ˋ().onClick(forumBanner);
                        forumBanner.ˊ();
                    }
                });
            }
        }
    }

    public void ˎ(BaseCardBean baseCardBean) {
        super.ˎ(baseCardBean);
    }
}
